<?php
/**
 * name：管理员列表
 * user：sa0
 * date：2021/3/11 14:23
 */
$type = Tool::gp('type', '0');
$page = Tool::gp('page', '1');
$size = Tool::gp('size', '10');
$where = 'where is_super = ?';
$parameters = [$type];
$l = ($page - 1) * $size;
$limit = "limit {$l},{$size}";
$col = '*';
if ($type == '1') $col = 'id,username,status,update_time,avatar';
$db = Db::get();
$sql = "select {$col} from `admin` {$where} {$limit}";
$admin_list = $db->getAll($sql, $parameters);
$sql = "select count(id) as c from `admin` {$where}";
$admin_count = $db->getRow($sql, $parameters);
Yo::echo([
    'list' => $admin_list,
    'count' => $admin_count['c'],
    'size' => $size,
    'page' => $page,
]);